﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Data.GameData
{
    public class WeaponSystem : ShipSystem, ICloneable
    {
        /*
  [Hit:6:6:5:4:3:2]
  [Dmg:2:2:2:2:2:2]
  [RoF:1]
         */
        private string toHit;
        private string damage;
        private int rof;

        public WeaponSystem()
            :base()
        {
        }

        public override bool BuildFromMetaData(Common.TokenReader.MetaObject meta)
        {
            base.BuildFromMetaData(meta);

            foreach (string token in meta.TokenList)
            {
                string[] tokens = token.Split(':');

                if (tokens[0].ToLower() == "hit")
                {
                    toHit = tokens[1];
                    continue;
                }
                if (tokens[0].ToLower() == "dmg")
                {
                    damage = tokens[1];
                    continue;
                }
                if (tokens[0].ToLower() == "rof")
                {
                    rof = int.Parse(tokens[1]);
                    continue;
                }
            }

            return true;
        }

        public override string ToString()
        {
            return base.ToString();
        }

        #region ICloneable Members
        public new object Clone()
        {
            return this.MemberwiseClone();
        }
        #endregion
    }
}
